//
//  ActivityTableViewCell.m
//  DouBan
//
//  Created by dllo on 16/6/24.
//  Copyright © 2016年 zuzhiming. All rights reserved.
//

#import "ActivityTableViewCell.h"
#import "ActivityModel.h"
#import "UIImageView+WebCache.h"
#import "NSString+separate.h"//自定义时间字符串分割
@interface ActivityTableViewCell ()
@property (retain, nonatomic) IBOutlet UILabel *titlLabel;
@property (retain, nonatomic) IBOutlet UILabel *timeLabel;
@property (retain, nonatomic) IBOutlet UILabel *addressLabel;
@property (retain, nonatomic) IBOutlet UILabel *typeLabel;
@property (retain, nonatomic) IBOutlet UILabel *interestLabel;
@property (retain, nonatomic) IBOutlet UILabel *joinLabel;
@property (retain, nonatomic) IBOutlet UIImageView *rightImage;

@end

@implementation ActivityTableViewCell

- (void)setModel:(ActivityModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
   
   self.titlLabel.text = _model.title;
   
   NSString *beginStr = [NSString componentsSeparateByString:_model.begin_time];
   NSString *endStr = [NSString componentsSeparateByString:_model.end_time];
   NSString *timeString = [NSString stringWithFormat:@"%@ -- %@", beginStr, endStr];
   self.timeLabel.text = timeString;
   
   self.addressLabel.text = model.address;
   self.typeLabel.text = model.category_name;
   self.interestLabel.text = [model.wisher_count description];  //number转换string
   self.joinLabel.text = [model.participant_count description];
   
   [self.rightImage sd_setImageWithURL:[NSURL URLWithString:_model.image]];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)dealloc {
    [_titlLabel release];
    [_timeLabel release];
    [_addressLabel release];
    [_typeLabel release];
    [_interestLabel release];
    [_joinLabel release];
    [_rightImage release];
    [_model release];
    [super dealloc];
}
@end
